import request from "@/utils/request"
import request1 from "@/utils/request1"

// 获取文件列表
export function getFileList(params) {
  return request({
    url: '/administrator/file/list',
    method: 'get',
    params
  })
}

// 删除文件
export function deleteFile(fileId) {
  return request({
    url: `/administrator/file/${ fileId }`,
    method: 'delete'
  })
}

// 下载文件
export function fileDownload(fileId) {
  return request1({
    url: `/administrator/file/download/${ fileId }/attachment`,
    method: 'get',
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 文件预览
export function viewFileOnline(fileId) {
  return request1({
    url: `/administrator/file/download/${ fileId }/inline`,
    method: 'get',
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 文件上传
export function fileUpload(data) {
  return request({
    url: '/administrator/file/upload',
    method: 'post',
    data
  })
}
